.NET Framework
The .NET Framework defines an environment that supports the development and execution of highly distributed, component-based applications. It enables differing computer languages to work together and provides for security, program portability, and a common programming model for the Windows platform.
.NET Framework defines two very important entities. The first is the Common Language Runtime (CLR). The second entity is the .NET Framework class library.
Common Language Runtime (CLR)
The Common Language Runtime manages the execution of .NET code. When you compile a C# program, the output of the compiler is not executable code. Instead, it is a file that contains a special type of pseudo code called Microsoft Intermediate Language (MSIL). MSIL defines a set of portable instructions that are independent of any specific CPU. In essence, MSIL defines a portable assembly language. One other point: Although MSIL is similar in concept to Java’s byte code.
CLR to translate the intermediate code into executable code when a program is run. Thus, any program compiled to MSIL can be run in any environment for which the CLR is implemented.
Microsoft Intermediate Language is turned into executable code by using a JIT compiler. When a .NET program is executed, the CLR activates the JIT compiler. The JIT compiler converts MSIL into native code on a demand basis as each part of your program is needed.
CLR Features
Feature |
Description |
.NET Framework Class |
Contains built-in types and libraries to manage assemblies, memory, security, threading, and other runtime system support |
Debugging |
Facilities for making it easier to debug code. |
Exception management |
Allows you to write code to create and handle exceptions. |
Execution management |
Manages the execution of code |
Garbage collection |
Automatic memory management and garbage collection |
Interop |
Backward-compatibility with COM and Win32 code. |
Just-In-Time (JIT) compilation |
An efficiency feature for ensuring that the CLR only compiles |
Security |
Traditional role-based security support, in addition to Code |
Thread management |
Allows you to run multiple threads of execution |
Type loading |
Finds and loads assemblies and types |
Type safety |
Ensures references match compatible types, which is very |
Process of Compilation and Execution process
If an application is for .NET, Windows starts up the CLR and passes the application to the CLR for execution. The CLR loads the executable assembly, finds the entry point, and begins its execution process.
Managed Code
When you write a C# program, you are creating what is called managed code. Managed code is executed under the control of the Common Language Runtime, as just described. Because it is running under the control of the CLR.
The benefits of managed code are many, including modern memory management, the ability to mix languages, better security, support for version control, and a clean way for software components to interact.
Unmanaged Code
The opposite of managed code is unmanaged code. Unmanaged code does not execute under the Common Language Runtime. Thus, all Windows programs prior to the creation of the .NET Framework use unmanaged code.
Common Language Infrastructure (CLI)
The Common Language Infrastructure (CLI) is a set of standards that ties all the components of the .NET Framework into a cohesive, consistent system. It lays out the concepts and architecture of the system.
CLI is as set of specifications that lays out the architecture, rules, and conventions of the system.
Parts of the CLI
Common Type System (CTS)
The Common Type System (CTS) defines the characteristics of the types that must be used in managed code. Some important aspects of the CTS are the following:
Common Language Specification
The CLS describes a set of features, such as data types, that different languages have in common. CLS compliance is especially important when creating software components that will be used by other languages.
.NET Framework Class Library (FCL)
NET has an extensive library, offering literally thousands of reusable types. Organized into namespaces, the FCL contains code supporting all the .NET technologies, such as Windows Forms, Windows Presentation Foundation, ASP.NET, ADO.NET, Windows Workflow, and Windows Communication Foundation.
Common .NET Framework Class Library Namespaces
System System.Runtime System.Configuration System.ServiceModel System.Diagnostics System.Threading System.IO System.Windows System.Net System.Xml |
System.Collections |
C# and Other .NET Languages
.NET supports multiple programming languages, which are assisted by both the CLR and the FCL.
A# Fortran Phalanger (PHP) C# J# Silverfrost FTN95 Delphi Mercury Smalltalk Zonnon |
APL |
C++ |